const footer = require('../footer/footer.js');
const app = getApp()
// pages/mid/mid.js
require('../footer/footer.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userId: app.globalData.userId,
    xiaoShou2WeiZhiXing: [],
    isSelect:'1'
  },
  pageReSetClick:function (params) {
    footer.pageReSetClick(params)
  },


  imgTongZhi:function (params) { 
    // console.log(1); 
    var str = params.currentTarget.dataset.id+"_"+params.currentTarget.dataset.danhao
    wx.navigateTo({ 
      url: '../fahuoTongZhi/fahuoTongZhi?id='+str, 
    }) 
  }, 
  ChuKu:function (params) { 
    this.data.xiaoShou2WeiZhiXing.forEach(element => {
      if (element["chukudanhao"] == params.currentTarget.dataset.chukudanhao) {
          getApp().globalData.chuku = element
          console.log(element);
      }
    });
    wx.navigateTo({ 
      url: '../saoma/saoma?danhao='+params.currentTarget.dataset.chukudanhao+'&id='+params.currentTarget.dataset.id, 
    }) 
  }, 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that = this
    console.log(wx.getStorageSync('userid'));
    getApp().globalData.userId = wx.getStorageSync('userid')
    var dataget = wx.request({
      url: 'https://127.0.0.1:10270/api/Return2WeiXin?userId='+app.globalData.userId+'&type=1',
      data: {
        userId: that.data.userId
      },
      method: "post",
      success: (result) => {
          that.setData({
            xiaoShou2WeiZhiXing: result.data.xiaoshouchukuReturnList
          })
          dataget.abort()
      },
      fail: (err) => {},
      complete: (res) => {},
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})